/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DisplayProfile.java
 *
 * Created on 23/04/2011, 21:20:02
 */
package implementation.gui.screens;

import implementation.client.IUserInput;
import implementation.client.IUserInput.EUserAction;


/**
 *
 * @author Maxim
 */
public class DisplayProfile extends javax.swing.JFrame {

    
	private  IUserInput _userOutputInput;
	private Object _monitor;
	
	
    public DisplayProfile(IUserInput userOutputInput, Object monitor) {
    	
    	this._userOutputInput = userOutputInput;
    	this._monitor = monitor;
    	
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        back = new javax.swing.JButton();
        exit = new javax.swing.JButton();
        friends = new javax.swing.JButton();
        addFriend = new javax.swing.JButton();
        removeFriend = new javax.swing.JButton();
        logout = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel2.setFont(new java.awt.Font("Tempus Sans ITC", 0, 14));
        jLabel2.setText("Malda Community:");

        back.setFont(new java.awt.Font("Tempus Sans ITC", 0, 11));
        back.setText("Back");
        back.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backActionPerformed(evt);
            }
        });

        exit.setFont(new java.awt.Font("Tempus Sans ITC", 0, 11));
        exit.setText("Exit");
        exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitActionPerformed(evt);
            }
        });

        friends.setFont(new java.awt.Font("Tempus Sans ITC", 0, 11));
        friends.setText("Show My Friends");
        friends.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                friendsActionPerformed(evt);
            }
        });

        addFriend.setFont(new java.awt.Font("Tempus Sans ITC", 0, 11)); // NOI18N
        addFriend.setText("Add Friend");
        addFriend.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addFriendActionPerformed(evt);
            }
        });

        removeFriend.setFont(new java.awt.Font("Tempus Sans ITC", 0, 11)); // NOI18N
        removeFriend.setText("Remove Friend");
        removeFriend.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeFriendActionPerformed(evt);
            }
        });

        logout.setFont(new java.awt.Font("Tempus Sans ITC", 0, 11));
        logout.setText("Logout");
        logout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 231, Short.MAX_VALUE)
                .addComponent(logout)
                .addGap(31, 31, 31))
            .addGroup(layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(back)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 306, Short.MAX_VALUE)
                .addComponent(exit)
                .addGap(35, 35, 35))
            .addGroup(layout.createSequentialGroup()
                .addGap(168, 168, 168)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(friends, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(addFriend, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(removeFriend, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(201, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(logout))
                .addGap(52, 52, 52)
                .addComponent(friends)
                .addGap(41, 41, 41)
                .addComponent(addFriend)
                .addGap(47, 47, 47)
                .addComponent(removeFriend)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(back)
                    .addComponent(exit))
                .addGap(19, 19, 19))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backActionPerformed
        
        this._userOutputInput.setSelectedAction(EUserAction.EBack);
        
        synchronized(this._monitor){
            this._monitor.notify();
        }
        this.dispose();
}//GEN-LAST:event_backActionPerformed

    private void exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitActionPerformed
        
        
        this._userOutputInput.setSelectedAction(EUserAction.EExit);
        
        synchronized(this._monitor){
            this._monitor.notify();
        }
        this.dispose();
    }//GEN-LAST:event_exitActionPerformed

    private void logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutActionPerformed
        
        this._userOutputInput.setSelectedAction(EUserAction.ELogout);
        
        synchronized(this._monitor){
            this._monitor.notify();
        }
        this.dispose();
    }//GEN-LAST:event_logoutActionPerformed

    private void friendsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_friendsActionPerformed
        
    	this._userOutputInput.setSelectedAction(EUserAction.EGetFriends);
        
        synchronized(this._monitor){
            this._monitor.notify();
        }
        this.dispose();
    }//GEN-LAST:event_friendsActionPerformed

    private void addFriendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addFriendActionPerformed
        
        this._userOutputInput.setSelectedAction(EUserAction.EAddFriend);
        
        synchronized(this._monitor){
            this._monitor.notify();
        }
        this.dispose();
    }//GEN-LAST:event_addFriendActionPerformed

    private void removeFriendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeFriendActionPerformed
       
        this._userOutputInput.setSelectedAction(EUserAction.ERemoveFriend);
        
        synchronized(this._monitor){
            this._monitor.notify();
        }
        this.dispose();
    }//GEN-LAST:event_removeFriendActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addFriend;
    private javax.swing.JButton back;
    private javax.swing.JButton exit;
    private javax.swing.JButton friends;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JButton logout;
    private javax.swing.JButton removeFriend;
    // End of variables declaration//GEN-END:variables
}
